#ifndef _BUILD_TABLE_
#define _BUILD_TABLE_
#include "Branch.h"
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

typedef struct 
{
    int vexnum,arcnum;
    vector<int> vex;
    vector<vector<int>> arcs;
}AMGrpha;

void readBranch(vector<Branch> &branch,string branchFile);
void printBranch(vector<Branch> &branch);
void build(vector<Branch> &branch,int N_on,int N_off,vector<vector<int>> &table,vector<Branch> &switchBranch);
void printTable(vector<vector<int>> &table);
void fillTable(vector<int> &randNum,int range,vector<vector<int>> &table,int col,int num);
void creatUDN(AMGrpha &G,vector<Branch> &branch);
void printUDN(AMGrpha &G);
void DFS(AMGrpha &G,vector<int> &visit,int startNode,int group);
bool testTable(AMGrpha &G,vector<vector<int>> &table,vector<Branch> &switchBranch,vector<int> &powerNode);
void buildSwitchBranch(vector<Branch> &branch,vector<Branch> &switchBranch,string switchFile);
bool findPower(vector<int> &powerNode,int num);
void initTable(vector<vector<int>> &table);



#endif
